namespace HomePortal.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class InitialCreate : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Posts",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        Title = c.String(),
                        MiniContent = c.String(),
                        Author = c.String(),
                        PublishDate = c.DateTime(nullable: false),
                        Rating = c.Int(nullable: false),
                        MainContent_ID = c.Int(),
                    })
                .PrimaryKey(t => t.ID)
                .ForeignKey("dbo.Contents", t => t.MainContent_ID)
                .Index(t => t.MainContent_ID);
            
            CreateTable(
                "dbo.Contents",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        FullContent = c.String(),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.Comments",
                c => new
                    {
                        CommentID = c.Int(nullable: false, identity: true),
                        PostID = c.Int(nullable: false),
                        UserName = c.String(),
                        CommentText = c.String(),
                        Rating = c.Int(nullable: false),
                        CommentDate = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.CommentID);
            
            CreateTable(
                "dbo.Tags",
                c => new
                    {
                        TagID = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                    })
                .PrimaryKey(t => t.TagID);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.Posts", new[] { "MainContent_ID" });
            DropForeignKey("dbo.Posts", "MainContent_ID", "dbo.Contents");
            DropTable("dbo.Tags");
            DropTable("dbo.Comments");
            DropTable("dbo.Contents");
            DropTable("dbo.Posts");
        }
    }
}
